package com.ymh.spring.learn.sw.demo5;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class MonitorAdvice {

	@Pointcut("execution (* com.ymh.spring.learn.sw.demo5.Speakable.*(..))")
	public void pointcut() {
	}

	@Around("pointcut()")
	public void around(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {

		MonitorSession.begin(proceedingJoinPoint.getSignature().getName());
		proceedingJoinPoint.proceed();
		MonitorSession.end();
	}
}
